import { Component } from 'react';
import './comment.scss'
import Header from '../../components/Comment/header/Header';
import List from '../../components/Comment/list/List'
class Comment extends Component {
    state = {
        title: "",
        content: "",
        list:[
            {
                title:"张三",
                content:"呜呜呜呜"
            }

        ]
    }
    setTitle=(data)=>{
        const list = [...this.state.list]
        list.push(data)
        this.setState({
            list
        })
        // console.log(this.state.list,'父组件');
    }
    render() {
        return (<>
            <div style={{ border: '1px solid #000', width:'300px',margin: '0 auto',padding:'0 20px'}}>
                <Header callback={this.setTitle}></Header>
                {/* 列表 */}
                <List list={this.state.list} ></List>
            </div>

        </>
        )
    }
}

export default Comment